<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>01-作用域链</title>
  </head>
  <body>
    <script>
        // 全局作用域
        let a = 11
        let b = 22

        // 局部作用域
        function fn() {
          let a = 1
          // 局部作用域
          function g() {
            a = 2
            console.log(a) // 2
          }
          g() // 调用g
        }
        fn() // 调用fn
    </script>
  </body>
</html>
